package com.hicc.cloud.teacher.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.hicc.cloud.R;
import com.hicc.cloud.teacher.activity.ClassComparedActivity;
import com.hicc.cloud.teacher.activity.ClassListActivity;
import com.hicc.cloud.teacher.utils.ConstantValue;
import com.hicc.cloud.teacher.utils.NetworkRequestUtil;

import mehdi.sakout.fancybuttons.FancyButton;


/**
 * Created by Administrator on 2016/9/24/024.
 * 导员
 */

public class TeacherHomeFragment extends BaseFragment implements View.OnClickListener {

    // 加载数据
    @Override
    public void fetchData() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_home_teacher, container, false);

        initUI(view);

        return view;
    }

    private void initUI(View view) {
        FancyButton btn_comparison = (FancyButton) view.findViewById(R.id.btn_comparison);
        FancyButton btn_file = (FancyButton) view.findViewById(R.id.btn_file);
        FancyButton btn_mark = (FancyButton) view.findViewById(R.id.btn_mark);
        FancyButton btn_dormitory = (FancyButton) view.findViewById(R.id.btn_dormitory);
        FancyButton btn_pay = (FancyButton) view.findViewById(R.id.btn_pay);

        btn_comparison.setOnClickListener(this);
        btn_file.setOnClickListener(this);
        btn_mark.setOnClickListener(this);
        btn_dormitory.setOnClickListener(this);
        btn_pay.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            // 报到对比
            case R.id.btn_comparison:
                Intent intent = new Intent(getContext(), ClassComparedActivity.class);
                startActivity(intent);
                break;
            // 学生档案
            case R.id.btn_file:
                // 向服务器发送点击的功能
                NetworkRequestUtil.postClickFunction(getContext(), "1");
                Intent intent0 = new Intent(getContext(), ClassListActivity.class);
                intent0.putExtra("type", ConstantValue.STUDENT_PROFILE);
                startActivity(intent0);
                break;
            // 学生成绩
            case R.id.btn_mark:
                // 向服务器发送点击的功能
                NetworkRequestUtil.postClickFunction(getContext(), "2");
                Intent intent1 = new Intent(getContext(), ClassListActivity.class);
                intent1.putExtra("type", ConstantValue.STUDENT_MARK);
                startActivity(intent1);
                break;
            // 宿舍成绩
            case R.id.btn_dormitory:
                Intent intentD = new Intent(getContext(), ClassListActivity.class);
                intentD.putExtra("type", ConstantValue.DORMITORY_SCORE);
                startActivity(intentD);
                break;
            // 交费统计
            case R.id.btn_pay:
                Intent intent2 = new Intent(getContext(), ClassListActivity.class);
                intent2.putExtra("type", ConstantValue.PAY_STATISTICS);
                startActivity(intent2);
                break;
        }
    }
}
